{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}
{{yield}}
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="jobInfo">
    <div class="panel panel-default">
      <div class="panel-body">
        <div class="row">
          <div class="col-md-12">
            <div class="col-md-2">Job Id</div>
            <div class="col-md-10">{{id}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">Status</div>
            <div class="col-md-10">{{model.status}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">User</div>
            <div class="col-md-10">{{model.user}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">Group</div>
            <div class="col-md-10">{{model.group}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">App Path</div>
            <div class="col-md-10" id="job-detail-app-path">{{model.coordJobPath}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">Frequency</div>
            <div class="col-md-10">{{model.frequency}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">Unit</div>
            <div class="col-md-10">{{model.timeUnit}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">Parent Bundle</div>
            <div class="col-md-10">{{model.bundleId}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">Created Time</div>
            <div class="col-md-10">{{model.createdTime}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">Start Time</div>
            <div class="col-md-10">{{model.startTime}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">Next Matd. Time</div>
            <div class="col-md-10">{{model.nextMaterializedTime}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">End Time</div>
            <div class="col-md-10">{{model.endTime}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">Pause Time</div>
            <div class="col-md-10">{{model.pauseTime}}</div>
          </div>
          <div class="col-md-12">
            <div class="col-md-2">Concurrency</div>
            <div class="col-md-10">{{model.concurrency}}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div role="tabpanel" class="tab-pane" id="jobAction">
    <div id="actions-list-header-conatiner">
      <table id="actions-list-header" class="table listing job-listing table-striped table-hover table-bordered">
        <thead>
          <tr>
            <th class="col-xs-2">Id</th>
            <th class="col-xs-1">Status</th>
            <th class="col-xs-2">External Id</th>
            <th class="col-xs-1">Error Code</th>
            <th class="col-xs-2">Created Time</th>
            <th class="col-xs-2">Nominal Time</th>
            <th class="col-xs-2">Last Modified Time</th>
          </tr>
        </thead>
      </table>
    </div>
    <div id="coord-actions-list-body-conatiner">
      <table id="actions-list-body" class="table listing job-listing table-striped table-hover table-bordered">
        <tbody>
          {{#each model.actions as |actionInfo|}}
          <tr class="{{if (eq actionInfo model.actionDetails) "active"}}">
            {{#if actionInfo.externalId}}
              <td class="pointer action-link col-xs-2" {{action 'showWorkflow' actionInfo.externalId}}>{{actionInfo.id}}</td>
            {{else}}
              <td class="col-xs-2">{{actionInfo.id}}</td>
            {{/if}}
            <td class="col-xs-1">{{actionInfo.status}}</td>
            <td class="col-xs-2">{{actionInfo.externalId}}</td>
            <td class="col-xs-1">{{actionInfo.errorCode}}</td>
            <td class="col-xs-2">{{actionInfo.createdTime}}</td>
            <td class="col-xs-2">{{actionInfo.nominalTime}}</td>
            <td class="col-xs-2">{{actionInfo.lastModifiedTime}}</td>
          </tr>
          {{/each}}
        </tbody>
      </table>
    </div>
  </div>
  <div role="tabpanel" class="tab-pane" id="jobDefinition">
    <div class="panel panel-default">
      <div class="panel-body preview">
        <pre class="prettyprint">
          {{ivy-codemirror value=jobDefinition options=(hash lineNumbers=false mode="xml" indentWithTabs=true readOnly=true)}}
        </pre>
      </div>
    </div>
  </div>
  <div role="tabpanel" class="tab-pane" id="jobConfig">
    <div class="panel panel-default">
      <div class="panel-body preview">
        <table class="table table-striped configuration-property-table listing">
          <thead>
            <tr>
              <th class="propertyName">Name</th>
              <th class="propertyValue">Value</th>
            </tr>
          </thead>
          <tbody>
            {{#each configurationProperties as |configurationProperty|}}
              <tr>
                <td class="propertyName">{{configurationProperty.name}}</td>
                <td class="propertyValue">{{configurationProperty.value}}</td>
              </tr>
            {{/each}}
          </tbody>
        </table>
      </div>
    </div>
  </div>
  <div role="tabpanel" class="tab-pane" id="jobLog">
    {{#job-log getJobLog="getJobLog" jobType=model.jobType jobLog=model.jobLog error=model.error}}{{/job-log}}
  </div>

  <div role="tabpanel" class="tab-pane" id="jobErrorLog">
    <div class="panel panel-default">
      <div class="panel-body preview">
        {{#if model.errorLog}}
          <pre>{{model.errorLog}}</pre>
        {{else if model.error}}
          <pre>{{model.errorLog}}</pre>
        {{else}}
          {{spin-spinner lines=8 length=5 width=3 radius=5 top=220}}
        {{/if}}
      </div>
    </div>
  </div>
  <div role="tabpanel" class="tab-pane" id="jobAuditLog">
    <div class="panel panel-default">
      <div class="panel-body preview">
        {{#if model.auditLog}}
          <pre>{{model.auditLog}}</pre>
        {{else if model.error}}
          <pre>{{model.auditLog}}</pre>
        {{else}}
          {{spin-spinner lines=8 length=5 width=3 radius=5 top=220}}
        {{/if}}
      </div>
    </div>
  </div>
  <div role="tabpanel" class="tab-pane" id="coordActionReruns">
    <div class="panel panel-default">
      <div class="panel-heading">
        <div class="form-inline">
          <label>Action List</label> {{input value=rerunActionList classNames="form-control"}}
          <button {{action 'getCoordActionReruns'}} type="button" class="btn btn-default">Get Workflows</button>
        </div>
      </div>
      <div class="panel-body">
        <table class="table listing table-striped table-hover table-bordered">
          <thead>
            <tr>
              <th>Workflow Id</th>
              <th>Workflow Status</th>
              <th>Start Time</th>
              <th>End Time</th>
            </tr>
          </thead>
          <tbody>
            {{#each model.coordActionReruns as |workflowInfo|}}
            <tr {{action 'showWorkflow' workflowInfo.id}}>
              <td>{{workflowInfo.id}}</td>
              <td>{{workflowInfo.status}}</td>
              <td>{{workflowInfo.startTime}}</td>
              <td>{{workflowInfo.endTime}}</td>
            </tr>
            {{/each}}
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>
